home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
oad11.zip
/
ONEADAY.DOC
< prev
next >
Wrap
Text File
|
1991-06-26
|
7KB
|
153 lines
ONEADAY.EXE Version 1.1 - Copyright (c) 1991 by James J. Murphy
FUNCTION
If you have a need to run a particular program once a day, once a
week, or once a month, or perform daily, weekly, or monthly BBS
functions, then ONEADAY is for you. ONEADAY is meant to be executed
by a batch file, in most cases from AUTOEXEC.BAT, but it is also
useful in the batch files that run BBS software. ONEADAY will execute
a special batch file either once per day, once per month, or on any
specified day of the week, or all three. The special batch file then
executes your designated programs.
WARNING
First off, you must know that this program will not function if you
attempt to make it a compressed executable using programs like PKLITE
ir LZEXE, or if you rename it. This is because it writes back to
itself, and if you rename it, it will not be able to find the file,
and if you compress it, it will not be able to locate the special
'flag' bytes that it searches for, to know where within itself to
write the data.
ONEADAY defaults to executing a special BATCH or BTM (4DOS Batch) file
once a day, when it is executed. The name of this file is OAD.BAT or
OAD.BTM (it also looks for OAD.BTM if executed in a 4DOS environment),
and it cannot be renamed.
USAGE: ONEADAY [D] [M] [0|1|2|3|4|5|6] [OAD-Path]
or ONEADAY RESET
or ONEADAY <Enter> for a Help screen.
The D parameter instructs ONEADAY to execute OAD.BAT/BTM once a day,
the first time it is run.
The M parameter tells ONEADAY to run OAD.BAT/BTM once a month, the
first time it is executed in a new month.
The 0 to 6 paramenters indicate what day during the week you want
OAD.BAT/BTM executed. 0=Sunday, 1=Monday, etc. You may specify more
than one day during the week, up to all 7 days.
The OAD-Path parameter tells the program where to find the batch file,
and has to end with a trailing backslash. If you happen to have the
OAD batch file located in a directory listed in your PATH
environmental variable, or you are located in the same directory as
OAD, then the OAD-Path parameter is not necessary.
The RESET parameter is used when testing ONEADAY.EXE and it refuses to
execute OAD.BAT/BTM again. Just run ONEADAY with the RESET parameter,
and the program will reset the daily, weekly, and monthly data in
itself, allowing you to test it again.
Executing ONEADAY with no parameters will give you a help screen.
To execute OAD.BAT/BTM once monthly, once per day, and also on Sunday,
Tuesday, and Wednesday, and giving the path to the batch file, you
would enter the following.
ONEADAY D 032 c:\path\ M
or
ONEADAY \batch\ m 320 d
The order of the parameters is not important. The paths shown are
just examples, substitute your paths there.
To execute OAD.BAT/BTM only on Monday and Thursday, you would enter
the following.
ONEADAY 14
Even though ONEADAY itself might be executed more than once a day, the
special batch file OAD.BAT/BTM is only executed on the days specified,
and only once.
ONEADAY passes special parameters to the OAD batch file which makes
sure that the daily, weekly, and monthly actions are only executed on
the days specified.
You must add the names of programs you want executed into the
OAD.BAT/BTM file using a text editor. Examine the sample OAD.BAT file
to see where to add your program names, it is commented to assist you.
In order for ONEADAY to write data back to itself, it must know where
ONEADAY.EXE is located. If you execute it within the same directory
where it is located, or in a directory listed in your PATH
evironmental variable, then there is no problem. But if you execute
it anywhere else, you would have to set an environmental variable
called OAD specifying the path to ONEADAY.EXE. You would normally set
this variable in your AUTOEXEC.BAT file BEFORE you execute the ONEADAY
program itself. This path has to end with a trailing backslash. An
example of setting the environmental variable OAD is as follows.
set OAD=C:\UTILITY\
You can achieve the fastest execution of this program by locating it,
and OAD in the same directory you execute it from, OR by setting the
environmental variable OAD to the path to ONEADAY.EXE, and also
specifying the path to OAD.BAT/BTM as a parameter when executing
ONEADAY. The program then doesn't have to search each directory of
your PATH list. This program always looks for OAD.BAT first, and if
in a 4DOS environment, then looks for OAD.BTM. So if you are running
under 4DOS and you have both BAT and BTM files in the same directory,
it will never execute OAD.BTM. If you should happen to have more than
one copy of ONEADAY.EXE in your path, you might experience strange
results if it locates the wrong file when writing back to itself.
HOW IT WORKS
There are 3 bytes within ONEADAY.EXE that are set to ASCII 32 when the
program was compiled (or if you run ONEADAY with the RESET parameter).
If ONEADAY is set to execute OAD.BAT/BTM daily, then the first of the
3 bytes is overwritten with todays day of the month number which will
be a 1 to 31. If ONEADAY is executed again the same day, it compares
the stored number with todays number, and if it is the same, does
nothing. The next byte is used for the weekly execution of OAD, and
it contains the day of the month number that ONEADAY executes OAD for
a weekly event, and the last byte contains the month number. When
testing ONEADAY, and you want the program to execute OAD again, just
type ONEADAY RESET, to restore the programs internal data, which
allows you to test it again.
TESTING ONEADAY
You can test out ONEADAY by placing it and the sample OAD.BAT file in
the same directory, and then run ONEADAY from the same directory,
passign it a 'D' parameter first, then a 'M' parameter, and finally
the day number as a parameter (Sunday=0, Monday=1, etc.). Then run it
three more times again, and notice that nothing happens this time. The
first time the OAD.BAT file echoes the type of parameter that was
passed to it, and during the second test nothing happens. Now type
'ONEADAY RESET <Enter>', and try out some combinations of your own, to
gain confidence in the program. There are rare instances when the
program may fail, such as only running ONEADAY with an 'M' (monthly)
parameter, during the same month each year. It would then just
execute the first time then never again. The same rare conditions can
also exist for the 'D' (daily), and the '0-6' (weekly) parameters, but
if you use your computer several times a month, you should not have
any problems.
This program is free, and it may be copied, and passed around freely
as long as ONEADAY.EXE, ONEADAY.DOC, and OAD.BAT are contained in the
archive, and they are unmodified in any way. You use this program at
your own risk, and I guarantee nothing. I assume no responsibility
for any damage caused by any use of this program. I have tested this
program on my computers, and it has functioned properly for me. If
you feel generous, you may send me (a struggling programmer) a check
or money order for $5.00 US currency (or whatever you think is fair)
to the following address:
James J. Murphy
PAC 0891 - P.O. Box 37301
Washington, DC 20013
You can send me bug reports by CompuServe Mail to User ID: 73750,2304